package gengine.common.packets;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

/**
 * Date: 04.03.13
 * Time: 20:59
 *
 * @author Zont
 */
public class PingPacket extends BasePacket {
    long creationTime=System.currentTimeMillis();
    public byte answer;

    @Override
    public PacketTypeEnum getPacketType() {
        return PacketTypeEnum.Ping;
    }

    @Override
    protected void writeCore(ObjectOutputStream stream) throws IOException {
        stream.writeByte(answer);
        stream.writeLong(creationTime);
    }

    @Override
    protected void readCore(ObjectInputStream stream) throws IOException {
        answer =stream.readByte();
        creationTime = stream.readLong();
    }

    public long getCreationTime() {
        return creationTime;
    }
}
